package Twice.day07.singleton;

/**
 * @Author: lya
 * @Description: 本类的作用描述:饿汉模式测试
 * @CreateDate: 2019/8/31
 * @Version: 1.0
 */
public class TestHungaryMyDataSource {
    public static void main(String[] args) {
        //HungaryMyDataSource hungaryMyDataSource = new HungaryMyDataSource();//会报错不能new

        HungaryMyDataSource h1 = HungaryMyDataSource.getInstance();
        HungaryMyDataSource h2 = HungaryMyDataSource.getInstance();

        System.out.println(h1);//Twice.day07.singleton.HungaryMyDataSource@4554617c
        System.out.println(h2);//Twice.day07.singleton.HungaryMyDataSource@4554617c
        System.out.println(h1 == h2);//true
    }
}
